package main

import (
	"crypto/ecdsa"
	"fmt"
	"github.com/ethereum/go-ethereum/common/hexutil"
	"github.com/ethereum/go-ethereum/crypto"
)

var (
	priHexKey = "0x45c418fbe5c252381bf1699d348362d12fc560c01f1be3dd9c576e6e6475caf6"

	//pubHexKey  = "0x04577dbedcd3fb13e8841512fe6ac0161144a327d14b3503d94599704dcba8cd781baa28c7a7a92c431866758dc34af430bcdb184ca5e676ff375dc11e34686c5f"
	//addressKey = "0x319d00d5b18831f68618bAbc024Ad995DF2Aa7F5"
)

func main() {
	privateKey, _ := crypto.HexToECDSA(priHexKey[2:])
	publicKey := privateKey.Public().(*ecdsa.PublicKey)
	fmt.Println("public Key:", hexutil.Encode(crypto.FromECDSAPub(publicKey)))
	address := crypto.PubkeyToAddress(*publicKey)
	fmt.Println("address:", address)
}
